﻿
Namespace Medien
	
	Public Class Medium
		
		Private _id As Integer
		Private _title As String
		Private _largeImageLink As String
		Private _mediumImageLink As String
		Private _smallImageLink As String
		Private _smallImageSet As List(Of String)
		Private _mediumImageSet As List(Of String)
		Private _largeImageSet As List(Of String)
		Private _runningTime As RunningTime
		Private _asin As String
		Private _isbn As String
		Private _eisbn As String
		Private _description As String
		Private _releaseDate As Date
		Private _productGroup As String
		Private _binding As String
		Private _similarProducts As List(Of SimilarProduct)
		Private _creators As List(Of Creator)
		Private _label As String
		
		Public Property Id() As Integer
			Get
				Return _id
			End Get
			Set
				_id = value
			End Set
		End Property
		
		Public Property Title() As String
			Get
				Return _title
			End Get
			Set
				_title = value
			End Set
		End Property
		
		Public Property LargeImageLink() As String
			Get
				Return _largeImageLink
			End Get
			Set
				_largeImageLink = value
			End Set
		End Property
		
		Public Property MediumImageLink() As String
			Get
				Return _mediumImageLink
			End Get
			Set
				_mediumImageLink = value
			End Set
		End Property
		
		Public Property SmallImageLink() As String
			Get
				Return _smallImageLink
			End Get
			Set
				_smallImageLink = value
			End Set
		End Property
		
		Public Property SmallImageSet() As List(Of String)
			Get
				Return _smallImageSet
			End Get
			Set
				_smallImageSet = value
			End Set
		End Property
		
		Public Property MediumImageSet() As List(Of String)
			Get
				Return _mediumImageSet
			End Get
			Set
				_mediumImageSet = value
			End Set
		End Property
		
		Public Property LargeImageSet() As List(Of String)
			Get
				Return _largeImageSet
			End Get
			Set
				_largeImageSet = value
			End Set
		End Property
		
		Public Property RunningTime() As RunningTime
			Get
				Return _runningTime
			End Get
			Set
				_runningTime = value
			End Set
		End Property
		
		Public Property Asin() As String
			Get
				Return _asin
			End Get
			Set
				_asin = value
			End Set
		End Property
		
		Public Property Isbn() As String
			Get
				Return _isbn
			End Get
			Set
				_isbn = value
			End Set
		End Property
		
		Public Property Eisbn() As String
			Get
				Return _eisbn
			End Get
			Set
				_eisbn = value
			End Set
		End Property
		
		Public Property Description() As String
			Get
				Return _description
			End Get
			Set
				_description = value
			End Set
		End Property
		
		Public Property ReleaseDate() As DateTime
			Get
				Return _releaseDate
			End Get
			Set
				_releaseDate = value
			End Set
		End Property
		
		Public Property ProductGroup() As String
			Get
				Return _productGroup
			End Get
			Set
				_productGroup = value
			End Set
		End Property
		
		Public Property Binding() As String
			Get
				Return _binding
			End Get
			Set
				_binding = value
			End Set
		End Property
		
		Public Property SimilarProducts() As List(Of SimilarProduct)
			Get
				Return _similarProducts
			End Get
			Set
				_similarProducts = value
			End Set
		End Property
		
		Public Property Creators() As List(Of Creator)
			Get
				Return _creators
			End Get
			Set
				_creators = value
			End Set
		End Property
		
		Public Property Label() As String
			Get
				Return _label
			End Get
			Set
				_label = value
			End Set
		End Property
		
		Public Sub New()
			_similarProducts = New List(Of SimilarProduct)
			_creators = New List(Of Creator)
			_smallImageSet = New List(Of String)
			_mediumImageSet = New List(Of String)
			_largeImageSet = New List(Of String)
		End Sub
		
		Public Shared Function FromAmazonItem( item As LibMedienverwaltung.Amazon.Item) As Medium
			
			Dim m As New Medium
			
			m.Title = item.ItemAttributes.Title
			m.Isbn = item.ItemAttributes.ISBN
			'm.Eisbn = item.ItemAttributes.EISBN(0)
			m.LargeImageLink = item.LargeImage.URL
			m.MediumImageLink = item.MediumImage.URL
			m.SmallImageLink = item.SmallImage.URL
			
			For Each imgSet As libmedienverwaltung.Amazon.ImageSet In item.ImageSets(0).ImageSet
				m.SmallImageSet.Add(imgSet.SmallImage.URL)
				m.MediumImageSet.Add(imgSet.MediumImage.URL)
				m.LargeImageSet.Add(imgSet.LargeImage.URL)
			Next
			
			try
				m.RunningTime = New RunningTime(item.ItemAttributes.RunningTime.Units , Decimal.ToInt32(item.ItemAttributes.RunningTime.Value))
			Catch ex As Exception
			End Try 
				
			
			Return m
		End Function
		
	End Class
	
End namespace